<?php  
session_start();
include ("../func/func.php"); 
if (isset($_SESSION['uin'])&&($row['uin']==48||$row['uin']==1)){ 
if ($d==2&&$send){
mysql_query("update nightw_geo.item set ".
"uron_1 = '$uron_1', uron_2 = '$uron_2', met = '$met', shot = '$shot', ".
"dal = $dal, tip = '$tip', pri = '$pri', pro = '$pro', info = '$info', ".
"pic = '$pic', name = '$name', ves = '$ves', slot_1 = '$slot_1', slot_2 = '$slot_2', ".
"slot_3 = '$slot_3', pow = '$pow', g_l = '$g_l', met_2 = '$met_2' ".
"where id = $id");
echo mysql_errno() . ": " . mysql_error() ; 
} 

if ($d==1&&$send){
mysql_query("insert into nightw_geo.item values ".
"('', '$uron_1', '$uron_2', '$met', '$shot', $dal, '$tip', '$pri', ".
"'$pro', '$info', '$pic', '$name', '$ves', '$slot_1', '$slot_2', '$slot_3', '$pow', '$g_l', '$met_2', '') ");
echo mysql_errno() . ": " . mysql_error() ; 
}
//insert into nightw_geo.item values ('', '15', '17', '65', '15', '14', '1', '35', '35', ' Desert AS-08<br>', 'as_08_m.gif', 'Desert AS-08-M', '3', '3', '0', '11', '95', 'gan_lev_2', '10', '1') 

?>
<?php include ("nav.php");?>
<br>
<table border="2" cellspacing="2" cellpadding="2" width="800" align='center'>
<tr>
<td>
<div align=right><b><?php if ($d==1)echo 'add item';if ($d==2)echo 'update item';?></b></div>
<form method="post" action="item_adm.php?d=<?php echo $d;?>">
Select Item:<br>
<select name="id">
<?php
$res = mysql_query("SELECT id, name FROM nightw_geo.item order by id");
while($row1 = mysql_fetch_row($res)){
echo "<option value=$row1[0] ";
if ($id == $row1[0])echo 'selected';
echo ">($row1[0]) $row1[1]</option>
";}
?>
<input type="submit" name="submit" value="select">
</select>
</form>
<HR>
<?php if ($d==2){
$res = mysql_query("SELECT * FROM nightw_geo.item where id = '$id'");
$row1 = mysql_fetch_assoc($res);
?>
<form method="post" action="item_adm.php?d=2&id=<?php echo $id;?>">
<br>
Name
<input type="text" name="name" value="<?php echo $row1['name'];?>" style="width:100%;">  
<br>
<table border="1" cellspacing="1" cellpadding="1" width=100%>
<tr>
  <td>
   uron_1 
  </td>
    <td>
   uron_2 
  </td>
    <td>
   met
  </td>
    <td>
   shot 
  </td>
    <td>
   dal
  </td>
    <td>
   tip
  </td>
    <td>
   pri
  </td>
    <td>
   pro
  </td>
    <td>
   pic
  </td>
<td>
   ves 
  </td>
    <td>
   slot_1 
  </td>
      <td>
   slot_2
  </td>
      <td>
   slot_3
  </td>
      <td>
   pow
  </td>
      <td>
   g_l 
  </td>
        <td>
   met_2
  </td>
</tr>
<tr>
  <td>
  <input type="text" name="uron_1" value="<?php echo $row1['uron_1'];?>" style="width:30;">
  </td>
    <td>
  <input type="text" name="uron_2" value="<?php echo $row1['uron_2'];?>" style="width:30;">  
  </td>
    <td>
  <input type="text" name="met" value="<?php echo $row1['met'];?>" style="width:30;">  
  </td>
    <td>
  <input type="text" name="shot" value="<?php echo $row1['shot'];?>" style="width:30;">   
  </td>
    <td>
  <input type="text" name="dal" value="<?php echo $row1['dal'];?>" style="width:30;">  
  </td>
    <td>
  <input type="text" name="tip" value="<?php echo $row1['tip'];?>" style="width:30;">  
  </td>
    <td>
  <input type="text" name="pri" value="<?php echo $row1['pri'];?>" style="width:70;">  
  </td>
    <td>
  <input type="text" name="pro" value="<?php echo $row1['pro'];?>" style="width:30;">  
  </td>
    <td>
  <input type="text" name="pic" value="<?php echo $row1['pic'];?>" style="width:70;">  
  </td>

    <td>
  <input type="text" name="ves" value="<?php echo $row1['ves'];?>" style="width:30;">  
  </td>
      <td>
  <input type="text" name="slot_1" value="<?php echo $row1['slot_1'];?>" style="width:30;">    
  </td>
      <td>
  <input type="text" name="slot_2" value="<?php echo $row1['slot_2'];?>" style="width:30;">    
  </td>
      <td>
  <input type="text" name="slot_3" value="<?php echo $row1['slot_3'];?>" style="width:30;">    
  </td>
      <td>
  <input type="text" name="pow" value="<?php echo $row1['pow'];?>" style="width:30;">    
  </td>
      <td>                                                         
  <input type="text" name="g_l" value="<?php echo $row1['g_l'];?>" style="width:70;">
  </td>
      <td>
  <input type="text" name="met_2" value="<?php echo $row1['met_2'];?>" style="width:30;"> 
  </td>  
</tr>  
</table> 
<br><br><br>
 

<textarea name="info" style="width:100%;height:150;">
<?php echo $row1['info'];?>
</textarea ><br><br>
<input type="hidden" name="send" value="1">
<div align=right><input type="submit" name="send" value="update"></div>
   



</form>



<?php } ?>
<?php if ($d==1){ ?>
<form method="post" action="item_adm.php?d=1">
<br>
Name
<input type="text" name="name" value="<?php echo $row1['name'];?>" style="width:100%;">  
<br>
<table border="1" cellspacing="1" cellpadding="1" width=100%>
<tr>
  <td>
   uron_1 
  </td>
    <td>
   uron_2 
  </td>
    <td>
   met
  </td>
    <td>
   shot 
  </td>
    <td>
   dal
  </td>
    <td>
   tip
  </td>
    <td>
   pri
  </td>
    <td>
   pro
  </td>
    <td>
   pic
  </td>
<td>
   ves 
  </td>
    <td>
   slot_1 
  </td>
      <td>
   slot_2
  </td>
      <td>
   slot_3
  </td>
      <td>
   pow
  </td>
      <td>
   g_l 
  </td>
        <td>
   met_2
  </td>
</tr>
<tr>
  <td>
  <input type="text" name="uron_1" value="<?php echo $row1['uron_1'];?>" style="width:30;">
  </td>
    <td>
  <input type="text" name="uron_2" value="<?php echo $row1['uron_2'];?>" style="width:30;">  
  </td>
    <td>
  <input type="text" name="met" value="<?php echo $row1['met'];?>" style="width:30;">  
  </td>
    <td>
  <input type="text" name="shot" value="<?php echo $row1['shot'];?>" style="width:30;">   
  </td>
    <td>
  <input type="text" name="dal" value="<?php echo $row1['dal'];?>" style="width:30;">  
  </td>
    <td>
  <input type="text" name="tip" value="<?php echo $row1['tip'];?>" style="width:30;">  
  </td>
    <td>
  <input type="text" name="pri" value="<?php echo $row1['pri'];?>" style="width:70;">  
  </td>
    <td>
  <input type="text" name="pro" value="<?php echo $row1['pro'];?>" style="width:30;">  
  </td>
    <td>
  <input type="text" name="pic" value="<?php echo $row1['pic'];?>" style="width:70;">  
  </td>

    <td>
  <input type="text" name="ves" value="<?php echo $row1['ves'];?>" style="width:30;">  
  </td>
      <td>
  <input type="text" name="slot_1" value="<?php echo $row1['slot_1'];?>" style="width:30;">    
  </td>
      <td>
  <input type="text" name="slot_2" value="<?php echo $row1['slot_2'];?>" style="width:30;">    
  </td>
      <td>
  <input type="text" name="slot_3" value="<?php echo $row1['slot_3'];?>" style="width:30;">    
  </td>
      <td>
  <input type="text" name="pow" value="<?php echo $row1['pow'];?>" style="width:30;">    
  </td>
      <td>                                                         
  <input type="text" name="g_l" value="<?php echo $row1['g_l'];?>" style="width:70;">
  </td>
      <td>
  <input type="text" name="met_2" value="<?php echo $row1['met_2'];?>" style="width:30;"> 
  </td>  
</tr>  
</table> 
<br><br><br>
 

<textarea name="info" style="width:100%;height:150;">
<?php echo $row1['info'];?>
</textarea ><br><br>
<input type="hidden" name="send" value="1">
<div align=right><input type="submit" name="send" value="add"></div>
   



</form>



<?php } ?>


</td>
</tr>
</table>





<?
}else {
header ("location: ../login.php");exit();}
?> 
</body>
</html>
